#ifndef _COMPOSITION_H
#define _COMPOSITION_H               
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <fstream>

using namespace std;

class ComPosition;

void minDistance(void);
                //finds the minimum distance between ComPositions and connects them. 
void getComPositions(ifstream &infile);
               //takes the computer no.s and their locations from file specified by infile
void displayConnection(void);          
              //displays the required output

void createConnection(ComPosition&,ComPosition&,double);
             

class ComPosition                    
 {  //class representing computer locations 
  private:
      int mX;
      int mY;
      int mJoins;                      
        //used to force no. of connections to a computer to be not more than 2

  public:
      ComPosition();     

      ComPosition(int,int);
	 
      void valuePos(int x,int y);
  
      float distance(ComPosition&);    
          //computes and returns distance 

      int getX(void)
       {return mX;
       }

      int getY(void)
       {return mY;
       }

      ComPosition& operator=(const ComPosition&);
 
      friend int operator==(ComPosition&,ComPosition&);
      friend void minDistance(void);
      friend void getComPositions(ifstream &infile);
};

class Connection                      
{ //class representing a connection 
  private:
     ComPosition Po1;
     ComPosition Po2;
     double mDistance;
  public:
     double getDistance(void)
      {return mDistance;
      }
 friend void displayConnection(void);
 friend void minDistance(void);
 friend void createConnection(ComPosition&,ComPosition&,double);
}; 
#endif
